#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

// https://leetcode.cn/problems/combinations/?envType=problem-list-v2&envId=z8Em6vKo
// 77. 组合

class Solution
{
public:
    void recursionTry(vector<vector<int>> &ans, int n, int k, vector<int> &curArr, unordered_map<int, int> &recordAddNumber)
    {
        if (k == 0)
        {
            ans.push_back(curArr);
            return;
        }
        for (int i = 1; i <= n; i++)
        {
            if (recordAddNumber[i] == 0)
            {
                recordAddNumber[i] = 1;
                curArr.push_back(i);
                recursionTry(ans, n, k - 1, curArr, recordAddNumber);
            }
            else
            {
                continue;
            }
            // 回溯
            recordAddNumber[i] = 0;
            curArr.pop_back();
        }
    }

    void f1(vector<vector<int>> &ans, int n, int k, vector<int> &curArr, int begin)
    {
        if (k == 0)
        {
            ans.push_back(curArr);
            return;
        }
        for (int i = begin; i <= n && n - begin + 1 >= k; i++)
        {
            curArr.push_back(i);
            f1(ans, n, k - 1, curArr, i + 1);
            curArr.pop_back();
        }
    }

    vector<vector<int>> combine(int n, int k)
    {
        vector<vector<int>> ans;
        vector<int> curArr;
        f1(ans, n, k, curArr, 1);
        return ans;
    }
};

int main()
{
    return 0;
}